<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    // console.log(a); //Uncaught ReferenceError: a is not defined
    var a = '123';
    console.log(a); //123
    window.a = '222';
    console.log(a); //222
</script>
</body>
</html>